<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@	page import="java.util.*"%>
<%
	Random rand = new Random();
	int num = rand.nextInt(100000);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="css/style.css" >
<link rel="stylesheet" type="text/css" href="css/form.css" >
<link rel="stylesheet" type="text/css" href="css/jquery.tabs.css" >
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="css/ui.jqgrid.css" />

<script type="text/javascript" src="js/jquery1.min.js" /></script>
<script type="text/javascript" src="js/jquery-ui.min.js" /></script>
<script type="text/javascript" src="js/grid.locale-en.js" /></script>
<script type="text/javascript" src="js/manageUsers.js?v=<%=num%>" /></script>
<script type="text/javascript" src="js/jquery.tabs.pack.js"  /></script>
<script type="text/javascript" src="js/jquery.jqGrid.min.js" /></script>
<title>Manage Users</title>

<script type="text/javascript">
    //<![CDATA[
    $(function(){
        var myGrid = $("#testgrid");
        myGrid.jqGrid({
            url:"/Yunysha/GridDataPopulation",
            datatype: 'json',
            mtype: 'POST',
            height: 300,
            colNames:['Name','Mobile', 'Email','Action'],
            colModel:[
                {name:'name',index:'name', width:250, sorttype:"string",search:true},
                {name:'mobile',index:'mobile', width:250,sorttype:"int",search:true},
                {name:'email',index:'email', width:250,sorttype:"string",search:true},
                {name:'action',index:'action', width:80, align:"left",search:false},
            ],
            multiselect: true,
            multiboxonly:true,
            caption: "Search Results",
            pager: '#testgridpager',
            gridview: true,
            pgbuttons:true,
            pgtext:'',
            shrinkToFit: false,
            width: 900,
            loadonce: true,
            sortname: 'id',
            sortorder: 'asc',
            multiselect: true,
            hoverrows: false,
            rowNum: 2000,
            jsonReader : { cell: "" }
        });

        //toolbar search
        myGrid.jqGrid('filterToolbar',{stringResult:true,searchOnEnter:false});
    });
    //]]>
    </script>
    <script type="text/javascript">
	$(function() {

		$('#container').tabs();
		$('#showcontent2').click(function() {
			$(this).parents('div').parents('div').eq(1).triggerTab(2);
			return false;
		});

		$('#showcontent3').click(function() {
			$(this).parents('div').parents('div').eq(1).triggerTab(3);
			return false;
		});

		$('#showcontent4').click(function() {
			$(this).parents('div').parents('div').eq(1).triggerTab(4);
			return false;
		});
	});
</script>
</head>
<body>
	<div id="main_container">
		<jsp:include page="header.jsp" />
		<div class="main_content">
			<jsp:include page="menu.jsp" />
			<br /> <br />
			<html:form action="/userMaster.do">
				<div class="clear"></div>
				<bean:define id="errorMessage" property='errorMessage'
					name='userMasterForm' />
				<bean:define id="isError" property='isError' name='userMasterForm' />
				<bean:define id="searchUserName" property='searchUserName'
					name='userMasterForm' />
				<bean:define id="searchUserMobile" property='searchUserMobile'
					name='userMasterForm' />
				<bean:define id="searchUserEmail" property='searchUserEmail'
					name='userMasterForm' />
				<logic:equal value="Y" property="isError" name="userMasterForm">
					<div class="error_box" style="height: auto;" id="messageBox">
						<div><%=(String) errorMessage%>
							<a href="javascript:fnCloseImage();"> <img
								src='images/close.gif' class="messagecloseimg">
							</a>
						</div>
					</div>
				</logic:equal>
				<logic:equal value="N" property="isError" name="userMasterForm">
					<div class="valid_box" style="height: auto;" id="messageBox">
						<div><%=(String) errorMessage%>
							<a href="javascript:fnCloseImage();"> <img
								src='images/close.gif' class="messagecloseimg">
							</a>
						</div>
					</div>
				</logic:equal>
				<br><br>
				<table id="testgrid"><tr><td/></tr></table>
			    <div id="testgridpager"></div>
				
				<table>
					<tr>
						<td width="45%"></td>
						<td width="15%"><a class="bt_green"
							href="javascript:fnCreateUser()"><span class="bt_green_lft"></span><strong>Add
									new User</strong><span class="bt_green_r"></span></a></td>
						<td width="35%"></td>
					</tr>
				</table>
				<br />
				<br />
				<logic:equal value="Y" property="isCreate" name="userMasterForm">
					<bean:define id="userFirstName" name="userMasterForm"
						property="userFirstName" />
					<bean:define id="userMiddleName" name="userMasterForm"
						property="userMiddleName" />
					<bean:define id="userLastName" name="userMasterForm"
						property="userLastName" />
					<bean:define id="userEmail" name="userMasterForm"
						property="userEmail" />
					<bean:define id="userMobile" name="userMasterForm"
						property="userMobile" />
					<bean:define id="userLoginId" name="userMasterForm"
						property="userLoginId" />

					<table width="100%">
						<tr>
							<td>
								<div style="margin: 10px;">
									<div id="container">
										<ul class="tabs-nav">
											<li><a href="#fragment1"><span> Personal
														Details </span></a></li>
										</ul>
										<div id="fragment1">
											<div class="content_area">
												<table>
													<tr>
														<td><span class="mandatory">*</span>First Name :</td>
														<td><html:text styleId="userFirstName"
																property="userFirstName" name="userMasterForm"
																value="<%=(String) userFirstName%>"
																styleClass="text_field_name" /></td>
													</tr>
													<tr>
														<td>Middle Name :</td>
														<td><html:text styleId="userMiddleName"
																property="userMiddleName" name="userMasterForm"
																value="<%=(String) userMiddleName%>"
																styleClass="text_field required" /></td>
													</tr>
													<tr>
														<td><span class="mandatory">*</span>Last Name :</td>
														<td><html:text styleId="userLastName"
																property="userLastName" name="userMasterForm"
																value="<%=(String) userLastName%>"
																styleClass="text_field_name" /></td>
													</tr>
													<tr>
														<td><span class="mandatory">*</span>Email :</td>
														<td><html:text styleId="userEmail"
																property="userEmail" name="userMasterForm"
																value="<%=(String) userEmail%>"
																styleClass="text_field_required" /></td>
													</tr>
													<tr>
														<td><span class="mandatory">*</span>Mobile :</td>
														<td><html:text styleId="userMobile"
																property="userMobile" name="userMasterForm"
																value="<%=(String) userMobile%>"
																styleClass="text_field_required" /></td>
													</tr>
													<tr>
														<td><span class="mandatory">*</span>Login Id :</td>
														<td><html:text styleId="userLoginId"
																property="userLoginId" name="userMasterForm"
																value="<%=(String) userLoginId%>"
																styleClass="text_field_required" /></td>
													</tr>
													<tr>
														<td><input type="button"
															onclick="javascript:saveUserDetails();" value="Save" /></td>
													</tr>
												</table>
											</div>
										</div>
									</div>
								</div>
							</td>
						</tr>
					</table>
				</logic:equal>
			</html:form>
		</div>
	</div>
</body>
</html:html>